package tool

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

const (
	Success    int = 200
	Fail       int = 400
	BadRequest int = 401
)

//请求成功
func ResponseSuccess(c *gin.Context, result interface{}) {
	c.JSON(http.StatusOK, gin.H{
		"code":   Success,
		"result": result,
		"msg":    "ok",
	})
}

//请求失败
func ResponseError(c *gin.Context, code int, msg string) {
	c.JSON(http.StatusOK, gin.H{
		"code": code,
		"msg":  msg,
	})
}
